$(document).on('ready', function(e)
{
  var sending = false;
  $('#btn_send').on('click', function(e)
  {
    e.preventDefault();
    if(!sending){
      sending = true;
      $.ajax('contacto/send-message.php', {
        data: $('#frm_contact').serialize(),
        type: 'post',
        dataType: 'json',
        beforeSend: function(jqXHR, Settings)
        {
          $('#loader').show();
        },
        success: function(ResponseData, status_text, jqXHR)
        {
          alert(ResponseData.message);
          if(!ResponseData.error){
            parent.$.fancybox.close();
          }
        },
        complete: function(jqXHR, status_text)
        {
          sending = false;
          $('#loader').hide();
        },
        error: function(jqXHR, status_text, error_thrown)
        {
          alert('Ocurrión un error al procesar la solicitud (' + error_thrown + ')');
        }
      });
    } // END: if(!sending)
  });
});